package special;

import java.util.Stack;

class CQueue {
    Stack<Integer> head;
    Stack<Integer> tail;
    public CQueue() {
        head = new Stack<>();
        tail = new Stack<>();
    }
    
    public void appendTail(int value) {
        head.push(value);
    }
    
    public int deleteHead() {
        if (tail.isEmpty()){
            if (head.isEmpty()){
                return -1;
            }
            while (!head.isEmpty()){
                tail.push(head.pop());
            }
        }
        return tail.pop();
    }
}